<template>

  <a-modal :title="title"
           :width="1200"
           :visible="listVisible"
           @ok="handleCancel"
           @cancel="listVisible=false"
           cancelText="关闭"
  >
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="挂号单ID">
                <a-input placeholder="请输入订单号" v-model="queryParam.recordId"></a-input>
              </a-form-item>
            </a-col>

            <a-col :xl="16" :lg="17" :md="18" :sm="24">
            <span style="float: left;overflow: hidden;margin-left: 568px" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" >查询</a-button>
              <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置</a-button>
<!--              <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!--                {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!--                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!--              </a>-->
            </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
<!--      <a-button type="primary"  @click="handleExportXls('patient')" style="margin-bottom: 6px;">导出</a-button>-->
      <!-- table区域-begin -->
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="orderInfo"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
          class="j-table-force-nowrap"
          @change="handleTableChange">

          <template slot="htmlSlot" slot-scope="text">
            <div v-html="text"></div>
          </template>
          <template slot="imgSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
            <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
          </template>
          <template slot="fileSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
            <a-button
              v-else
              :ghost="true"
              type="primary"
              icon="download"
              size="small"
              @click="downloadFile(text)">
              下载
            </a-button>
          </template>

<!--          <span slot="action" slot-scope="text, record">-->
<!--          <a @click="handleEdit(record)">编辑</a>-->
<!--          <a-divider type="vertical" />-->
<!--          <a @click="handleMoney(record)">对账单</a>-->
        </a-table>
      </div>
    </a-card>
  </a-modal>


</template>

<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { mixinDevice } from '@/utils/mixin'
  import Area from '@comp/_util/Area'
  import { getAction } from '@api/manage'

  export default {
    name: "DoctorRegisterHospitalOrderModal",


    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
    data () {
      return {
        description: 'DoctorRegisterHospitalList',
        title:"对账单",
        listVisible:false,
        visible: false,
        labelCol: {
          xs: { span: 8 },
          sm: { span: 8 },

        },
        wrapperCol: {
          xs: { span: 20 },
          sm: { span: 16 },
        },
        columns: [
          {
            title:'账单ID',
            align:"center",
            dataIndex: 'id'
          },
          {
            title:'渠道应收（￥）',
            align:"center",
            dataIndex: 'hospitalAccount'
          },
          {
            title:'医生应收（￥）',
            align:"center",
            dataIndex: 'doctorAccount'
          },
          {
            title:'关联业务',
            align:"center",
            dataIndex: '',
            customRender:function (text) {
              return "挂号单结算"
            }
          },
          {
            title:'关联挂号单ID',
            align:"center",
            dataIndex: 'doctorRegisterRecordId'
          },
          {
            title:'时间',
            align:"center",
            dataIndex: 'createTime',
            customRender:function (text) {
              return !text?"":(text.length>16?text.substr(0,16):text)
            }
          },
        ],
        url: {
          list: "/doctorRegisterHospital/doctorRegisterHospital/order",
        },
        orderInfo:{}
      }
    },
    created() {
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      open(record){
        var param = { 'hospitalId' : record.id }
        getAction(this.url.list,param).then((res)=>{

          console.log(res);
          this.orderInfo = res.result.records
        }).catch((error)=>{
          console.log(error);
        })
        this.listVisible = true;
      },

      handleCancel(){
        this.listVisible = false;
      },

    }

  }
</script>

<style scoped>


  @import '~@assets/less/common.less';
</style>